<?php
/**
 * @brief 
 * 
 * @license		http://www.gnu.org/licenses/gpl-3.0.txt GNU General Public License
 * @copyright	2008 David Singer
 * @author		David Singer <david@ramaboo.com>
 * @version		1.0.0
 */

require_once('../../includes/common.php');

try {
	if (!isset($_POST['zone'])) {
		throw new Exception("Zone is required.");
		exit;
	}
	$zone = htmlentities(strtolower(trim($_POST['zone'])));
	
	$json = array();
	$z = new Zone;
	
	$z->open($zone);
	$z->remove();
	
	$json['success'] = true;
	$json['msg'] = "Zone $zone removed.";
} catch (Exception $e) {
	$json['success'] = false;
	$json['msg'] = $e->getMessage();
}

$output = json_encode($json);
header_no_cache(strlen($output), 'application/json');
echo $output;
?>